package c.c.a;

import android.content.SharedPreferences;
import android.os.SystemClock;
import android.text.TextUtils;
import java.util.UUID;
import org.json.JSONObject;

public final class d2 extends b2 {
    public final g2 e;

    public d2(g2 g2Var) {
        super(true, false);
        this.e = g2Var;
    }

    public boolean b(JSONObject jSONObject) {
        SharedPreferences sharedPreferences = this.e.e;
        String str = t0.a;
        long elapsedRealtime = SystemClock.elapsedRealtime();
        String str2 = "cdid";
        if (r0.a.compareAndSet(false, true)) {
            String string = sharedPreferences.getString(str2, "");
            r0.b = string;
            if (TextUtils.isEmpty(string)) {
                r0.b = UUID.randomUUID().toString();
                sharedPreferences.edit().putString(str2, r0.b).apply();
            }
        }
        String str3 = r0.b;
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append(t0.a);
        stringBuilder.append("getCdid takes ");
        stringBuilder.append(SystemClock.elapsedRealtime() - elapsedRealtime);
        stringBuilder.append(" ms");
        u0.a("TrackerDr", stringBuilder.toString(), null);
        if (TextUtils.isEmpty(str3)) {
            return false;
        }
        jSONObject.put(str2, str3);
        return true;
    }
}
